<!-- 问诊记录 -->

<template>
	<div>
		<table-no-height
			:dataSource="dataSource"
			:tableColumns="tableColumns"
			:height="500"
		></table-no-height>
	</div>
</template>

<script>
	import tableNoHeight from "@/components/customComponents/customeTable/tableNoHeight"
	import { AjaxCommon } from "@/libs/apiCommon"
	import { PopupCommon } from "@/libs/popupCommon"
	export default {
		components: {
			tableNoHeight,
		},
		props: ["userInfo", "type", "isFirst"],
		data() {
			return {
				dataSource: [],
				tableColumns: [
					{
						prop: "inquiryItemName",
						label: "问诊项",
            width: 180,
					},
					{
						prop: "inquiryItemExplain",
						label: "说明",
						width: 250,
					},
					{
						prop: "inquiryItemResult",
						label: "问诊结果",
            dictName: "select_option",
            width: 120,
					},
					{
						prop: "inquiryItemRemarks",
						label: "问诊备注",
            width: 250,
					},
					{
						prop: "remark",
						label: "备注",
						width: 250,
					},
					{
						prop: "createByName",
						label: "问诊人",
						width: 120,
					},
          {
            prop: "createTime",
            label: "记录时间",
            width: 180,
          },
				],
			}
		},
		methods: {
			initData() {
				this.getData(this.userInfo)
			},
			getData(user) {
				let self = this
				let url =
					this.type == "filter"
						? "/ccdc/pm/em/filter/emFilterInquiry/queryById?examineeCode=" + user.examineeCode
						: "/ccdc/pm/em/in/emInInquiryRecord/queryById?examineeCode=" + user.examineeCode
				// 这里的isFirst 不一定是boolen类型
				let first = this.isFirst ? true : false
				AjaxCommon(
					url,
					"get",
					// {
          //   examineeCode: user.examineeCode,
					// },
					first
				)
					.then((res) => {
						if (res.data.code == 200) {
							self.dataSource = res.data.result
						} else {
							PopupCommon.notify("error", res.data.message)
						}
					})
					.catch((err) => {
						PopupCommon.notify("error", err.message)
					})
			},
		},
		mounted() {
			this.initData()
		},
	}
</script>
